import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class ComboxDemo(QWidget):
    def __init__(self,parent=None):
        super(ComboxDemo,self).__init__(parent)
        self.setWindowTitle("下拉列表")
        self.resize(300,100)
        layout=QVBoxLayout()
        self.lb1=QLabel()
        self.cb=QComboBox()
        self.cb.addItem("python")
        self.cb.addItem("java")
        self.cb.addItems(["js","C"])
        self.cb.currentIndexChanged.connect(self.selectionchange)
        layout.addWidget(self.cb)
        layout.addWidget(self.lb1)
        self.setLayout(layout)
    def selectionchange(self):
        self.lb1.setText(self.cb.currentText())
        for count in  range(self.cb.count()):
            #print('item'+str(count)+'='+self.cb.itemText(count))
            print(self.cb.currentText())

if __name__ == '__main__':
    app=QApplication(sys.argv)
    win=ComboxDemo()
    win.show()
    sys.exit(app.exec_())